#include "BlendState.h"

namespace Display
{
	BlendState::BlendState()
	{
		DeviceUserBase();
		state = nullptr;

		ZeroMemory(&desc,sizeof(D3D11_BLEND_DESC));
	}

	BlendState::~BlendState()
	{
		Dispose();
	}

	void BlendState::Dispose()
	{
		if(state != nullptr)
		{
			state->Release();
			state = nullptr;
		}
	}

	void BlendState::Apply()
	{
		if(state != nullptr)
		{
			ID3D11DeviceContext * context = GetContext();
			context->OMSetBlendState(state,nullptr,0xffffffff);
			context = nullptr;
		}
	}

	void BlendState::SubmitChanges()
	{
		Dispose();
		SetUp();
	}

	void BlendState::SetUp()
	{
		//to do 
	}

	BlendState * BlendState::Create(ID3D11Device * device)
	{
		BlendState * blendState = new BlendState();
		blendState->SetDevice(device);


		return blendState;
	}

}